<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>PowerVR SDK</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<table width="100%">
  <tr>
    <td width="33%">
      <p align="left">&nbsp;<a href="http://www.imgtec.com"><img border="0" src="IMGLogo.jpg" width="200" height="30"></a></p>
    </td>
    <td width="33%">
      <p align="center"><font color="#808080" face="Arial" size="2">PowerVR Software Development Kit</a></font></p>
    </td>
    <td width="34%">
      <p align="right"><a href="http://www.powervr.com"><img border="0" src="PVRlogo.jpg" width="200" height="27"></a></p>
    </td>
  </tr>
</table>
<hr>
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div>
<h1>PVRTMisc.h</h1><a href="PVRTMisc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/******************************************************************************</span>
00002 <span class="comment"></span>
00003 <span class="comment"> @File         PVRTMisc.h</span>
00004 <span class="comment"></span>
00005 <span class="comment"> @Title        PVRTMisc</span>
00006 <span class="comment"></span>
00007 <span class="comment"> @Version      </span>
00008 <span class="comment"></span>
00009 <span class="comment"> @Copyright    Copyright (C)  Imagination Technologies Limited.</span>
00010 <span class="comment"></span>
00011 <span class="comment"> @Platform     ANSI compatible</span>
00012 <span class="comment"></span>
00013 <span class="comment"> @Description  Miscellaneous functions used in 3D rendering.</span>
00014 <span class="comment"></span>
00015 <span class="comment">******************************************************************************/</span>
00016 <span class="preprocessor">#ifndef _PVRTMISC_H_</span>
00017 <span class="preprocessor"></span><span class="preprocessor">#define _PVRTMISC_H_</span>
00018 <span class="preprocessor"></span>
00019 <span class="preprocessor">#include "<a class="code" href="PVRTMatrix_8h.html">PVRTMatrix.h</a>"</span>
00020 <span class="preprocessor">#include "<a class="code" href="PVRTFixedPoint_8h.html">PVRTFixedPoint.h</a>"</span>
00021 
00022 <span class="comment">/****************************************************************************</span>
00023 <span class="comment">** Functions</span>
00024 <span class="comment">****************************************************************************/</span>
00025 
00026 <span class="comment">/*!***************************************************************************</span>
00027 <span class="comment"> @Function          PVRTMiscCalculateIntersectionLinePlane</span>
00028 <span class="comment"> @Input             pfPlane         Length 4 [A,B,C,D], values for plane</span>
00029 <span class="comment">                                    equation</span>
00030 <span class="comment"> @Input             pv0             A point on the line</span>
00031 <span class="comment"> @Input             pv1             Another point on the line</span>
00032 <span class="comment"> @Output            pvIntersection  The point of intersection</span>
00033 <span class="comment"> @Description       Calculates coords of the intersection of a line and an</span>
00034 <span class="comment">                    infinite plane</span>
00035 <span class="comment">*****************************************************************************/</span>
00036 <span class="keywordtype">void</span> <a class="code" href="PVRTMisc_8h.html#a0">PVRTMiscCalculateIntersectionLinePlane</a>(
00037     <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a>         * <span class="keyword">const</span> pvIntersection,
00038     <span class="keyword">const</span> VERTTYPE      pfPlane[4],
00039     <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a>   * <span class="keyword">const</span> pv0,
00040     <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a>   * <span class="keyword">const</span> pv1);
00041 
00042 <span class="comment">/*!***************************************************************************</span>
00043 <span class="comment"> @Function      PVRTMiscCalculateInfinitePlane</span>
00044 <span class="comment"> @Input         nStride         Size of each vertex structure containing pfVtx</span>
00045 <span class="comment"> @Input         pvPlane         Length 4 [A,B,C,D], values for plane equation</span>
00046 <span class="comment"> @Input         pmViewProjInv   The inverse of the View Projection matrix</span>
00047 <span class="comment"> @Input         pFrom           Position of the camera</span>
00048 <span class="comment"> @Input         fFar            Far clipping distance</span>
00049 <span class="comment"> @Output        pfVtx           Position of the first of 3 floats to receive</span>
00050 <span class="comment">                                the position of vertex 0; up to 5 vertex positions</span>
00051 <span class="comment">                                will be written (5 is the maximum number of vertices</span>
00052 <span class="comment">                                required to draw an infinite polygon clipped to screen</span>
00053 <span class="comment">                                and far clip plane).</span>
00054 <span class="comment"> @Returns       Number of vertices in the polygon fan (Can be 0, 3, 4 or 5)</span>
00055 <span class="comment"> @Description   Calculates world-space coords of a screen-filling</span>
00056 <span class="comment">                representation of an infinite plane The resulting vertices run</span>
00057 <span class="comment">                counter-clockwise around the screen, and can be simply drawn using</span>
00058 <span class="comment">                non-indexed TRIANGLEFAN</span>
00059 <span class="comment">*****************************************************************************/</span>
00060 <span class="keywordtype">int</span> <a class="code" href="PVRTMisc_8h.html#a1">PVRTMiscCalculateInfinitePlane</a>(
00061     VERTTYPE            * <span class="keyword">const</span> pfVtx,
00062     <span class="keyword">const</span> <span class="keywordtype">int</span>           nStride,
00063     <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR4f.html">PVRTVECTOR4</a>   * <span class="keyword">const</span> pvPlane,
00064     <span class="keyword">const</span> <a class="code" href="classPVRTMATRIXf.html">PVRTMATRIX</a>    * <span class="keyword">const</span> pmViewProjInv,
00065     <span class="keyword">const</span> <a class="code" href="structPVRTVECTOR3f.html">PVRTVECTOR3</a>   * <span class="keyword">const</span> pFrom,
00066     <span class="keyword">const</span> VERTTYPE      fFar);
00067 
00068 <span class="comment">/*!***************************************************************************</span>
00069 <span class="comment"> @Function      PVRTCreateSkybox</span>
00070 <span class="comment"> @Input         scale           Scale the skybox</span>
00071 <span class="comment"> @Input         adjustUV        Adjust or not UVs for PVRT compression</span>
00072 <span class="comment"> @Input         textureSize     Texture size in pixels</span>
00073 <span class="comment"> @Output        Vertices        Array of vertices</span>
00074 <span class="comment"> @Output        UVs             Array of UVs</span>
00075 <span class="comment"> @Description   Creates the vertices and texture coordinates for a skybox</span>
00076 <span class="comment">*****************************************************************************/</span>
00077 <span class="keywordtype">void</span> <a class="code" href="PVRTMisc_8h.html#a2">PVRTCreateSkybox</a>(<span class="keywordtype">float</span> scale, <span class="keywordtype">bool</span> adjustUV, <span class="keywordtype">int</span> textureSize, VERTTYPE** Vertices, VERTTYPE** UVs);
00078 
00079 <span class="comment">/*!***************************************************************************</span>
00080 <span class="comment"> @Function      PVRTDestroySkybox</span>
00081 <span class="comment"> @Input         Vertices    Vertices array to destroy</span>
00082 <span class="comment"> @Input         UVs         UVs array to destroy</span>
00083 <span class="comment"> @Description   Destroy the memory allocated for a skybox</span>
00084 <span class="comment">*****************************************************************************/</span>
00085 <span class="keywordtype">void</span> <a class="code" href="PVRTMisc_8h.html#a3">PVRTDestroySkybox</a>(VERTTYPE* Vertices, VERTTYPE* UVs);
00086 
00087 <span class="comment">/*!***************************************************************************</span>
00088 <span class="comment"> @Function      GetPOTHigher</span>
00089 <span class="comment"> @Input         uiOriginalValue Base value</span>
00090 <span class="comment"> @Input         iTimesHigher        Multiplier</span>
00091 <span class="comment"> @Description   When iTimesHigher is one, this function will return the closest</span>
00092 <span class="comment">                power-of-two value above the base value.</span>
00093 <span class="comment">                For every increment beyond one for the iTimesHigher value,</span>
00094 <span class="comment">                the next highest power-of-two value will be calculated.</span>
00095 <span class="comment">*****************************************************************************/</span>
00096 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="PVRTMisc_8h.html#a4">GetPOTHigher</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> uiOriginalValue, <span class="keywordtype">int</span> iTimesHigher);
00097 
00098 <span class="comment">/*!***************************************************************************</span>
00099 <span class="comment"> @Function      GetPOTLower</span>
00100 <span class="comment"> @Input         uiOriginalValue Base value</span>
00101 <span class="comment"> @Input         iTimesLower     Multiplier</span>
00102 <span class="comment"> @Description   When iTimesLower is one, this function will return the closest</span>
00103 <span class="comment">                power-of-two value below the base value.</span>
00104 <span class="comment">                For every increment beyond one for the iTimesLower value,</span>
00105 <span class="comment">                the next lowest power-of-two value will be calculated. The lowest</span>
00106 <span class="comment">                value that can be reached is 1.</span>
00107 <span class="comment">*****************************************************************************/</span>
00108 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="PVRTMisc_8h.html#a5">GetPOTLower</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> uiOriginalValue, <span class="keywordtype">int</span> iTimesLower);
00109 
00110 <span class="preprocessor">#endif </span><span class="comment">/* _PVRTMISC_H_ */</span>
00111 
00112 
00113 <span class="comment">/*****************************************************************************</span>
00114 <span class="comment"> End of file (PVRTMisc.h)</span>
00115 <span class="comment">*****************************************************************************/</span>
00116 
</pre></div><br>
<br>
<P align=left><FONT size=2><STRONG><A 
   href="http://www.imgtec.com/powervr/insider/legal/index.asp">Copyright</A> � 
   1999-2008, Imagination Technologies Ltd.</STRONG></FONT></P>
<hr>
<address style="align: left;"><small><FONT color=f0f>
Generated by <a href="http://www.doxygen.org/index.html">DOXYGEN</a> 1.3.6</small></address>
</body>
</html>
